﻿using System;
using System.Windows;
using SilverlightWebcamEncoder.Helpers;

namespace SilverlightWebcamEncoder.Views
{
    public partial class EncoderView
    {
        public EncoderView()
        {
            InitializeComponent();
            Loaded += EncoderView_Loaded;
        }

        public event EventHandler InjectionCompleted;

        private void EncoderView_Loaded(object sender, RoutedEventArgs e)
        {
            if (App.Injector == null)
                return;

            App.Injector.StartInject();
            InvokeInjectionCompleted();
        }

        public void InvokeInjectionCompleted()
        {
            EventArgs e = new EventArgs();
            EventHandler handler = InjectionCompleted;
            if (handler != null) handler(this, e);
        }

        private void Button_Click(object sender, RoutedEventArgs e)
        {
            encoder.PrepareEncoding();
        }
    }
}
